package pl.pkolodziej.platform.vo.user;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang.StringEscapeUtils;

import pl.pkolodziej.platform.vo.course.UserCourseInfo;

@Entity
@Table(name="user_info")
public class UserInfo {

	@Id
	@Column(name="username")
	private String username = "";
	
	@Column(name="firstname")
	private String firstname = "";
	
	@Column(name="lastname")
	private String lastname = "";
	
	@Column(name="birthdate")
	private String birthdate = "";
	
	@Column(name="street")
	private String street = "";
	
	@Column(name="city")
	private String city = "";
	
	@Column(name="post")
	private String post = "";
	
	@Column(name="companyname")
	private String companyname = "";
	
	@Column(name="companyaddress")
	private String companyaddress = "";
	
	@Column(name="group_id")
	private String group_id = "";

	@OneToMany(fetch=FetchType.EAGER)
	@JoinColumn(name="username")
	private List<UserCourseInfo> userCourseInfo;
	
	@Column(name="msg1")
	private String msg1 = "";
	
	@Column(name="msg2")
	private String msg2 = "";
	
	@Column(name="msg3")
	private String msg3 = "";
	
	@Column(name="msg4")
	private String msg4 = "";
	
	@Column(name="msg5")
	private String msg5 = "";
	
	@Column(name="msg6")
	private String msg6 = "";
	
	@Column(name="msg7")
	private String msg7 = "";
	
	@Column(name="msg8")
	private String msg8 = "";
	
	public String getMsg1() {
		return msg1;
	}

	public void setMsg1(String msg1) {
		this.msg1 = msg1;
	}

	public String getMsg2() {
		return msg2;
	}

	public void setMsg2(String msg2) {
		this.msg2 = msg2;
	}

	public String getMsg3() {
		return msg3;
	}

	public void setMsg3(String msg3) {
		this.msg3 = msg3;
	}

	public String getMsg4() {
		return msg4;
	}

	public void setMsg4(String msg4) {
		this.msg4 = msg4;
	}

	public String getMsg5() {
		return msg5;
	}

	public void setMsg5(String msg5) {
		this.msg5 = msg5;
	}

	public String getMsg6() {
		return msg6;
	}

	public void setMsg6(String msg6) {
		this.msg6 = msg6;
	}

	public String getMsg7() {
		return msg7;
	}

	public void setMsg7(String msg7) {
		this.msg7 = msg7;
	}

	public String getMsg8() {
		return msg8;
	}

	public void setMsg8(String msg8) {
		this.msg8 = msg8;
	}

	public String getGroup_id() {
		return group_id;
	}

	public void setGroup_id(String group_id) {
		this.group_id = group_id;
	}

	public List<UserCourseInfo> getUserCourseInfo() {
		return userCourseInfo;
	}

	public void setUserCourseInfo(List<UserCourseInfo> userCourseInfo) {
		this.userCourseInfo = userCourseInfo;
	}

	public String getBirthdate() {
		return StringEscapeUtils.unescapeHtml(birthdate);
	}

	public void setBirthdate(String birthdate) {
		this.birthdate = birthdate;
	}

	public String getStreet() {
		return StringEscapeUtils.unescapeHtml(street);
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getCity() {
		return StringEscapeUtils.unescapeHtml(city);
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getPost() {
		return StringEscapeUtils.unescapeHtml(post);
	}

	public void setPost(String post) {
		this.post = post;
	}

	public String getCompanyname() {
		return StringEscapeUtils.unescapeHtml(companyname);
	}

	public void setCompanyname(String companyname) {
		this.companyname = companyname;
	}

	public String getCompanyaddress() {
		return StringEscapeUtils.unescapeHtml(companyaddress);
	}

	public void setCompanyaddress(String companyaddress) {
		this.companyaddress = companyaddress;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getFirstname() {
		return StringEscapeUtils.unescapeHtml(firstname);
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return StringEscapeUtils.unescapeHtml(lastname);
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	
	public Boolean isProfileFull(){
		return (firstname.length()>0 && lastname.length()>0 && birthdate.length()>0 && city.length()>0);
	}
	
}
